package com.education.welco.service.impl;

import com.education.common.utils.Convert;
import com.education.welco.mapper.STheoryClassroomMapper;
import com.education.welco.pojo.STheoryClassroom;
import com.education.welco.pojo.TClass;
import com.education.welco.service.ISTheoryClassroomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 理论课堂 服务层实现
 *
 * @author d
 * @date 2020-05-11
 */
@Service
public class STheoryClassroomServiceImpl implements ISTheoryClassroomService {

    @Autowired
    private STheoryClassroomMapper sTheoryClassroomMapper;

    /**
     * 进行统计
     *
     * @param userId 理论课堂ID
     * @return 理论课堂信息
     */
    @Override
    public Integer selectSTheoryClassroomCount(Integer userId) {
        return sTheoryClassroomMapper.selectSTheoryClassroomCount(userId);
    }

    /**
     * 查询理论课堂信息
     *
     * @param id 理论课堂ID
     * @return 理论课堂信息
     */
    @Override
    public STheoryClassroom selectSTheoryClassroomByIdOther(Integer id) {
        return sTheoryClassroomMapper.selectSTheoryClassroomByIdOther(id);
    }

    /**
     * 查询理论课堂信息
     *
     * @param id 理论课堂ID
     * @return 理论课堂信息
     */
    @Override
    public STheoryClassroom selectSTheoryClassroomById(Integer id) {
        return sTheoryClassroomMapper.selectSTheoryClassroomById(id);
    }

    @Override
    public List<Integer> selectSTheoryClassroomListByTime(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListByTime(sTheoryClassroom);
    }

    @Override
    public List<TClass> selectSTheoryClassroomListByTimeAndIn(STheoryClassroom theoryClassroom) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListByTimeAndIn(theoryClassroom);
    }

    @Override
    public Integer selectClassStuNumByCatalogId(Integer catalogId) {
        return sTheoryClassroomMapper.selectClassStuNumByCatalogId(catalogId);
    }

    @Override
    public List<Integer> selectClassIdsByCatalogId(Integer catalogId) {
        return sTheoryClassroomMapper.selectClassIdsByCatalogId(catalogId);
    }

    @Override
    public List<STheoryClassroom> selectTeaCourseListByTeaId(Integer teaUserId) {
        return sTheoryClassroomMapper.selectTeaCourseListByTeaId(teaUserId);
    }

    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    @Override
    public List<STheoryClassroom> selectSTheoryClassroomListByClassroomAndTime(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListByClassroomAndTime(sTheoryClassroom);
    }

    /**
     * 查询理论课堂列表
     *
     * @param map 理论课堂信息
     * @return 理论课堂集合
     */
    @Override
    public List<STheoryClassroom> selectSTheoryClassroomListOtherTwo(Map<String, Object> map) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListOtherTwo(map);
    }

    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    @Override
    public List<STheoryClassroom> selectSTheoryClassroomListOther(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListOther(sTheoryClassroom);
    }

    @Override
    public List<STheoryClassroom> selectPaikeList(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.selectPaikeList(sTheoryClassroom);
    }


    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    @Override
    public List<STheoryClassroom> selectSTheoryClassroomList(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.selectSTheoryClassroomList(sTheoryClassroom);
    }

    /**
     * 为解绑班级的设备查找当前时刻下该班级是否有直播课
     *
     * @param classroomId 班级id
     * @param nowDate     当前时刻
     * @return
     */
    @Override
    public List<STheoryClassroom> selectSTheoryClassroomListForNowLive(Integer classroomId, Date nowDate) {
        return sTheoryClassroomMapper.selectSTheoryClassroomListForNowLive(classroomId, nowDate);
    }

    /**
     * 新增理论课堂
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 结果
     */
    @Override
    public int insertSTheoryClassroom(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.insertSTheoryClassroom(sTheoryClassroom);
    }

    /**
     * 修改理论课堂
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 结果
     */
    @Override
    public int updateSTheoryClassroom(STheoryClassroom sTheoryClassroom) {
        return sTheoryClassroomMapper.updateSTheoryClassroom(sTheoryClassroom);
    }

    @Override
    public int deleteSTheoryClassroomById(Integer id) {
        return sTheoryClassroomMapper.deleteSTheoryClassroomById(id);
    }

    /**
     * 删除理论课堂对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSTheoryClassroomByIds(String ids) {
        return sTheoryClassroomMapper.deleteSTheoryClassroomByIds(Convert.toStrArray(ids));
    }
}